package com.iisigroup.audf.statistics.logic;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;

import com.iisigroup.audf.model.Audf1000;

public class BaseLogic {

     
    public Map<String,List<Audf1000>> process(final List<Audf1000> srcList) {
	final Map<String,List<Audf1000>> collection = new HashMap<String,List<Audf1000>>();
	for(final Audf1000 unit : srcList){
	   final String txId =  unit.getTxId();
	   List<Audf1000> list = collection.get(txId);
	   if(list==null){
	       list=new ArrayList<Audf1000>();
	   }
	   list.add(unit);
	   collection.put(txId, list);
	}
	return collection; 
    }
    public long processSeqNo(String srcSeqNo) throws ParseException{
	String init= StringUtils.substring(srcSeqNo, 6, 21);
	SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmssSSS");
	long result = sdf.parse(init).getTime();
	return result;
    }
    public String caculateExeTime(long startTime,long endTime,float lastMethodExecTime){
	SimpleDateFormat sdf = new SimpleDateFormat("mmssSSS");
	 long init = endTime-startTime ;
	
	String result =  sdf.format(new Date(init));
	 System.out.println(result);
	return "";
    }
}
